import service from '@/utils/request'

export const useDictTypeAllApi = () => {
  return service.get('/sys/dict/type/all')
}

export const useDictTypeApi = (id) => {
  return service.get('/sys/dict/type/' + id)
}

export const useDictTypeSubmitApi = (dataForm) => {
  if (dataForm.id) {
    return service.put('/sys/dict/type', dataForm)
  } else {
    return service.post('/sys/dict/type', dataForm)
  }
}

export const useDictDataApi = (id) => {
  return service.get('/sys/dict/data/' + id)
}

export const useDictDataSubmitApi = (dataForm) => {
  if (dataForm.id) {
    return service.put('/sys/dict/data', dataForm)
  } else {
    return service.post('/sys/dict/data', dataForm)
  }
}

export const useDictData = (dictType) => {
  return service.get('/sys/dict/type/dict/' + dictType)
}

export const useDictAll = (params) => {
  return service.get('/sys/dict/type/all/like', { params })
}
